package com.winning.sx.microframework.dao.entity;

import com.winning.dapi.data.api.IDataAccessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;

import java.sql.SQLException;
import java.util.Map;

@Repository
public class TreatDao {
    @Autowired
    @Qualifier("dataSource")
    protected IDataAccessService iDataAccessService;
    public boolean deleteTreat(String TABLE_NAMNE, Map<String, String> param) throws SQLException {
        int result = -1;
        try {
            String sql = "delete BASE_PatientTreat where updateTime!="+param.get("updateTime");
            result = iDataAccessService.executeSql(sql);
            if (result < 1) {
                return false;
            } else {
                return true;
            }
        } catch (Exception e) {
            e.printStackTrace();
            throw new SQLException("获取信息失败！");
        }
    }
    public boolean deletePatientInfo(String TABLE_NAMNE, Map<String, String> param) throws SQLException {
        int result = -1;
        try {
            String sql = "delete BASE_PatientInfo where updateTime!="+param.get("updateTime");
            result = iDataAccessService.executeSql(sql);
            if (result < 1) {
                return false;
            } else {
                return true;
            }
        } catch (Exception e) {
            e.printStackTrace();
            throw new SQLException("获取信息失败！");
        }
    }
}
